home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 24
/
Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso
/
Aminet
/
dev
/
c
/
cpost_1_4.lha
/
cpost.doc
< prev
next >
Wrap
Text File
|
1995-05-09
|
18KB
|
473 lines
cPost - C language file formatter for PostScript
by Patrick Mueller
pmuellr@vnet.ibm.com
----------------------------------------------------
What is cPost?
----------------------------------------------------
cPost is a program which will take a number of c and h files as input
and create a PostScript file. The PostScript file will contain the
contents of the input files that have been marked up so that various
parts are highlighted.
----------------------------------------------------
cPost invocation and options
----------------------------------------------------
When cPost is invoked, it examines the command line for file names and
options. The file names may contain wildcards. Running cPost with no
file names or with a ? as the first parameter will write some brief help
to standard error.
Options are blank delimited 'words' which begin with a '-'. The case of
the character following the - is not significant. Options may be placed
before, after or in between file names. If the same option is specified
more than once on the command line, only the last option is used.
Options may also be specified in the CPOST environment variable.
Command line options override environment variable options.
A typical invocation of cPost might be
cpost *.c *.h > project.ps
This invocation will include all c and h files, use any options
set in the CPOST environment variable, and write the output to the
file 'project.ps'.
Note that the options used in the environment variable are used as-is,
which means that quote processing which is normally done on the OS/2
commandline parameters is not done on environment variable values.
Thus, it is not possible to use an option which has a value which
includes spaces.
You may also use a list file to determine the files to process.
The list file is just a plain text file that contains the names of
other files in it. Prepend the list file name with a '@' when you
use it on the command line. The list file can contains any number
of file names. They can be entered on one line apiece, or multiple
names can be on one line as long as they are separated with white
space. Blank lines, and lines that begin with a '#' character
are ignored. If a '@-' is given on the command line, file names
to process will be read from stdin.
Valid options are:
-b[+|-]
enable/disable bracketing level
Use -b+ to have all levels of braces within file bracketed. Use
-b- to cause no bracketing.
-cext1,ext2,...
treat files with extension ext1 and ext2 as C files
For example, -cc,y,sqc will cause files with 'extensions' c, y,
and sqc (case insensitive) to be considered c files. This
information is used to determine sorting order. Note that the
'extension' is considered the text after the first '.' in the
name, up to the last character, or next '.' in the name.
-d[+|-]
enable/disable duplex
Duplex processing causes two things to happen: the header1 proc
is used for odd number pages, and the header2 proc is used for
even number pages; and a blank page will be printed for files
that end on an odd numbered page. If duplexing is not on, the
header1 proc is used for both even and odd pages, and extra blank
pages will not be printed. The header1 and header2 procs may be
customized with the -i option.
-hext1,ext2,...
treat files with extension ext1 and ext2 as H files
For example, -hh,rh,sqh will cause files with 'extensions' h, rh,
and sqh (case insensitive) to be considered h files. This
information is used to determine whether function definition and
usage are valid within the file, and to determine sorting order.
Note that the 'extension' is considered the text after the
first '.' in the name, up to the last character, or next '.' in
the name.
-ifile1;file2;...
imbed PostScript files into the output file
This option is used to redefine fonts, margins and headers for
your document. Multiple files can be imbedded - they will be
imbedded in the order specified. See Customization below.
-kkey1,key2,...
treat key1, key2, etc as reserved words
In addition to the ANSI reserved words, the following are
considered reserved (SAA extensions): _Packed, _System,
_Optlink, _Far16, _Cdecl, _Pascal. If one of the keys specified
is 'c++', the following tokens will be considered reserved words:
catch, class, delete, friend, inline, new, operator, private,
protected, public, template, this, throw, try, virtual. To make
additional words reserved, use the -k option. For instance,
-kNULL,FILE adds NULL and FILE as reserved words. This option is
used merely to control the highlighting of the tokens.
You may also use a file that contains the keywords. To do this,
prepend a '@' to the filename, and use that as a key on the -k
option. The contents of the file should be in the same format
as list files, described above, except keywords are enclosed in
the file, and not filenames.
-n#
separate line numbers from lines with # spaces.
When 0 is specified, no line numbers are generated.
-ofileName
output written to the file named fileName.
Without this option, output is written to stdout.
-p[+|-]
enable/disable best-fit page break at functions
When this option is enabled, functions that can fit on a page by
themselves will be printed on a single page. Basically this means
that page ejects occur between functions. But if multiple
functions do fit on a page, they will be printed on a page
together.
-rfile1;file2;...
replace default PostScript procedures with those in another file
This option is used to replace the PostScript procedures
generated by cPost with your own. This is for power-users
who think they can produce nicer looking output than I can!
See customization below.
-snt or -stn
sort files by name/type or type/name
When sorting by type, the files are first sorted by whether they
are c, h, or neither (see -c and -h options), and then by the
actual extension. All sorting is done in a case insensitive
manner.
-t#
expand tabs to # columns
The default is 4, which causes the characters immediately
following tab characters to be placed in columns 5, 9, 13, ...
-xx,y
coordinates to with translate for page
This option is provided to help bridge the difference between
PostScript printers. Because the printable area on printers is
different, you might create a set of margin and header
definitions that print fine on one printer, but are clipped on
another printer. This option inserts a translate operation into
the PostScript file before a page is written to, to offset the
printing by a certain amount. For example, -x0,18 would be used
to move the printout on the page up 1/4 inch. The units must be
given in points (72 points/inch).
-ypath
path to use for temporary files
A copy of each input file read is created during the cPost run.
By default, these copies are created in your current directory.
This option allows you to specify a different location for the
temporary files.
-?
display online help
The default options are
-b+ -d- -cc -hh -n2 -p+ -stn -t4 -x0,0
----------------------------------------------------
Customizing cPost output
----------------------------------------------------
Customization of the cPost output is done by including additional
PostScript code in the output file, and optionally not adding some of
the PostScript code normally written by cPost. The code you add must be
valid PostScript code - it is not checked or processed by cPost at all.
The output of cPost can be used as a starting point for creating new
code. For an intro